<template>
	<div class="closing-type">
		<el-dialog title="房态修改" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false" :show-close="false">
			<el-form ref="form">
				<el-row>
					<el-col :span="24">
						<el-form-item label="房 型:" >
							{{options.goodsName}}
						</el-form-item>
					</el-col>
				</el-row>
				
				<el-row>
					<el-col :span="24">
						<el-form-item label="生效日期:" >
							{{options.dayTime | $YYYY_MM_DD}}
						</el-form-item>
					</el-col>
				</el-row>

				<el-row>
					<el-col :span="24">
						<el-form-item label="设置房态:" >
							  <el-radio v-model="options.closingType" :label="0">设置开房</el-radio>
							  <el-radio v-model="options.closingType" :label="1">设置关房</el-radio>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
			<div slot="footer" class="dialog-footer" >
				<el-button type="primary" @click="handleSubmitForm" :loading="btnLoading">保 存</el-button>
				<el-button @click="handleCancel" :disabled="btnLoading" style="margin-left: 20px;">取 消</el-button>
			</div>
		</el-dialog>
	</div>
</template>
<script>
	import {priceCalendarUpdateCalendar} from "@/api/shopping/content";
	export default {
		name: "ClosingType",
		data() {
			return {
				open: false,
				btnLoading: false,
				options: {}
			}
		},
		methods: {
			init(options) {
				this.options = {...options};
				this.open = true;
			},
		 async handleSubmitForm() {
				try{
					this.btnLoading = true;
					let res = await priceCalendarUpdateCalendar(this.options);
					this.$emit('on-success');
					this.open = false;
					this.btnLoading = false;
				}catch(e){
					this.btnLoading =false;
					console.error(e)
				}
			},
			handleCancel() {
				this.open = false;
			}
		}
	}
</script>
<style lang="scss" scoped>
	::v-deep .dialog-footer{
		text-align: center;
	}
	.closing-type {}
</style>
